﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WP09S03_OfficeTracking.UserControls
{
    public partial class CtrlItemSearch : UserControl
    {
        public CtrlItemSearch()
        {
            InitializeComponent();
        }


        public TextBox TEXTBOX_ID
        {
            get {
                return txtID;
            }
        }

        public TextBox TEXTBOX_Name
        {
            get
            {
                return txtName;
            }
        }


        public TextBox TEXTBOX_Brand
        {
            get
            {
                return txtBrand;
            }
        }


        public TextBox TEXTBOX_Model
        {
            get
            {
                return txtModel;
            }
        }

        public ComboBox ComboBox_Category
        {
            get {
                return cboCategory;
            }
        }

        private void CtrlItemSearch_Load(object sender, EventArgs e)
        {
            //bind category

            
            Controller.ItemController ic = new Controller.ItemController();


            DAL.DSItem.CategoryDataTable dt;

            if (intConsumable < 0)
            {

                dt = ic.getCategories();
            }
            else {

                dt = ic.getCategories(Convert.ToBoolean(intConsumable));
            }

            DAL.DSItem.CategoryRow row = dt.NewCategoryRow();

            row.CategoryID = 0;
            row.CategoryName = "ALL";

            dt.Rows.InsertAt(row,0);


            cboCategory.DataSource = dt;
            cboCategory.DisplayMember = "CategoryName";
            cboCategory.ValueMember = "CategoryID";


            
          
        }

        private int intConsumable=-1;

        public int Consumable {

            get { return intConsumable; }
            set { intConsumable = value; }
        }

      
    }
}
